package com.itheima.dao;

import com.github.pagehelper.Page;
import com.itheima.POJO.Address;
import com.itheima.entity.QueryPageBean;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface MapMapper {
    @Select("<script>select * from t_address<where><if test='queryString!=null and queryString.length>0'>address like concat('%',#{queryString},'%')</if></where></script>")
    Page<Address> findAddress(QueryPageBean queryPageBean);

    @Delete("delete from t_address where id=#{param1}")
    void deleteAddress(String id);

    @Select("select * from t_address")
    List<Address> getAddress();

    @Insert("insert into t_address values(null,#{address},#{longitude},#{latitude})")
    void addAddress(@Param("longitude") String longitude, @Param("latitude")String latitude,@Param("address") String address);
}
